package com.etc.medical.client;

import com.etc.common.utils.Result;
import com.etc.drug.entity.OutBound;
import com.etc.drug.entity.Prescription;
import com.etc.medical.breaker.PrescriptionBreak;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

@FeignClient(value = "sp-drug", fallback = PrescriptionBreak.class)
public interface PrescriptionClient {
    @RequestMapping("/ps/queryByDocId")
    Result queryByDocId(@RequestParam("pageNum") Integer pageNum, @RequestParam("pageSize") Integer pageSize,
                        @RequestParam("docId") String docId);

    @RequestMapping("/ps/queryByOsId")
    Result queryByOsId(@RequestParam("osId") String osId);

    @RequestMapping(value = "/ps/insert", method = RequestMethod.POST)
    Result insert(@RequestParam("patientId") String patientId,@RequestParam("osId") String osId,
                  @RequestParam("prescriptionUsage") String prescriptionUsage,
                  @RequestParam("auditorId") String auditorId,
                  @RequestBody List<OutBound> outBoundList,
                  @RequestParam("operatorId") String operatorId);

    @RequestMapping(value = "/ps/update", method = RequestMethod.POST)
    Result update(@RequestBody Prescription prescription, @RequestParam("operatorId") String operatorId);

    @RequestMapping(value = "/ps/breakDrug", method = RequestMethod.POST)
    Result breakDrug(@RequestParam("prescriptionId") String prescriptionId, @RequestParam("operatorId") String operatorId);

    @RequestMapping("/ps/queryDrugDoc")
    Result queryDrugDoc();
}
